<template>
  <div class="register-container">
    <el-card class="register-card">
      <template #header>
        <div class="card-header">
          <span>用户注册</span>
        </div>
      </template>
      
      <el-form :model="registerForm" label-width="80px">
        <el-form-item label="用户名">
          <el-input v-model="registerForm.username" placeholder="请输入用户名"></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input v-model="registerForm.password" type="password" placeholder="请输入密码" show-password></el-input>
        </el-form-item>
        <el-form-item label="确认密码">
          <el-input v-model="registerForm.confirmPassword" type="password" placeholder="请再次输入密码" show-password></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleRegister" style="width: 100%;">注册</el-button>
        </el-form-item>
      </el-form>
      
      <div class="login-link">
        已有账号？<router-link to="/login">立即登录</router-link>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { ElMessage } from 'element-plus';

const router = useRouter();

const registerForm = ref({
  username: '',
  password: '',
  confirmPassword: '',
});

const handleRegister = () => {
  // TODO: Add actual registration logic here
  console.log('Registration attempt:', registerForm.value);
  if (registerForm.value.password !== registerForm.value.confirmPassword) {
    ElMessage.error('两次输入的密码不一致。');
    return;
  }
  
  // Simulate successful registration
  ElMessage.success('注册成功！请登录。');
  router.push('/login');
};
</script>

<style scoped>
.register-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  /* Dark background with subtle gradient */
  background: linear-gradient(135deg, #1e3a5c 0%, #2c5282 100%); /* Slightly darker gradient */
  padding-top: 80px; /* Adjust for fixed header */
  color: #e0e7ff; /* Lighter text color for contrast */
  overflow: auto; /* Allow scrolling if content is too long */
}

.register-card {
  width: 450px; /* Slightly wider card */
  background-color: rgba(30, 58, 90, 0.95); /* More opaque dark background */
  border: 2px solid #63a3e0; /* Brighter blue border */
  border-radius: 12px; /* More rounded corners */
  box-shadow: 0 0 30px rgba(99, 163, 224, 0.8); /* Larger and more intense blue glowing shadow */
  padding: 30px; /* More padding */
  color: #e0e7ff; /* Ensure text inside card is light */
  position: relative; /* Needed for pseudo-elements */
  overflow: hidden; /* Hide overflowing pseudo-elements */
}

/* Optional: Add a subtle tech pattern or overlay */
.register-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(99, 163, 224, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.card-header {
  font-size: 1.8em; /* Even larger font size */
  font-weight: bold;
  text-align: center;
  margin-bottom: 30px; /* More space below header */
  color: #63a3e0; /* Brighter blue header color */
  text-shadow: 0 0 8px #63a3e0; /* More pronounced text shadow */
}

/* Styling for Element Plus Form */
.el-form-item label {
  color: #a5b4fc; /* Lighter blue-grey for labels */
  font-size: 1.1em; /* Larger label font */
}

:deep(.el-input__wrapper) {
  background-color: rgba(49, 68, 92, 0.8); /* Darker input background */
  box-shadow: none !important;
  border: 1px solid #63a3e0; /* Brighter blue border for input */
  border-radius: 8px; /* Rounded input corners */
  transition: border-color 0.3s ease, box-shadow 0.3s ease; /* Add transition */
}

:deep(.el-input__inner) {
  color: #e0e7ff; /* Light text color for input */
  color: #a5b4fc !important; /* Lighter blue-grey placeholder */
}

:deep(.el-input__inner::placeholder) {
  color: #a5b4fc; /* Lighter blue-grey placeholder */
}

:deep(.el-input__wrapper.is-focus) {
  border-color: #3b82f6 !important; /* Even brighter blue on focus */
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.9) !important; /* More intense shadow on focus */
}

:deep(.el-button--primary) {
  background-color: #3b82f6; /* Vibrant blue button */
  border-color: #3b82f6; /* Vibrant blue border */
  font-size: 1.2em; /* Larger button text */
  font-weight: bold;
  letter-spacing: 1px; /* Add letter spacing */
  transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease; /* Add transform transition */
  border-radius: 8px; /* Rounded button corners */
}

:deep(.el-button--primary:hover) {
  background-color: #2563eb; /* Darker blue on hover */
  border-color: #2563eb; /* Darker blue border on hover */
  box-shadow: 0 0 20px rgba(59, 130, 246, 1); /* More intense shadow on hover */
  transform: translateY(-2px); /* Subtle lift effect */
}

.login-link {
  text-align: center;
  margin-top: 30px; /* More space above link */
  font-size: 1em; /* Slightly larger font size */
  color: #a5b4fc; /* Lighter blue-grey text */
}

.login-link a {
  color: #63a3e0; /* Brighter blue link color */
  text-decoration: none;
  transition: color 0.3s ease, text-decoration 0.3s ease; /* Add text-decoration transition */
}

.login-link a:hover {
  color: #3b82f6; /* Even brighter blue on hover */
  text-decoration: underline; /* Underline on hover */
}
</style> 